package com.pk.platform.business.privilege.web;

import com.pk.platform.business.core.web.GenericAction;
import com.pk.platform.business.privilege.service.IRoleService;
import com.pk.platform.business.privilege.vo.RoleVO;
import com.pk.platform.domain.privilege.Role;

public class RoleAction extends GenericAction {

	private IRoleService roleService;
	
	private RoleVO rvo = new RoleVO();
	
	private Role role = new Role();
	
	private String[] roleIds;
	
	public String queryRole()
	{
		lp = roleService.queryRole(rvo, pager);
		return SUCCESS;
	}
	
	public String toAddRole()
	{
		return SUCCESS;
	}
	
	public String addRole()
	{
		roleService.addRole(role);
		return SUCCESS;
	}
	
	public String toUpdateRole()
	{
		role = roleService.queryRoleById(role.getId());
		return SUCCESS;
	}
	
	public String updateRole()
	{
		roleService.updateRole(role);
		return SUCCESS;
	}
	
	public String delRoles()
	{
		if(roleIds != null)
		{
			roleService.delRoles(roleIds);
		}
		this.sendRedirect("inner/role/queryRole.action");
		return SUCCESS;
	}

	public IRoleService getRoleService() {
		return roleService;
	}

	public void setRoleService(IRoleService roleService) {
		this.roleService = roleService;
	}

	public RoleVO getRvo() {
		return rvo;
	}

	public void setRvo(RoleVO rvo) {
		this.rvo = rvo;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public String[] getRoleIds() {
		return roleIds;
	}

	public void setRoleIds(String[] roleIds) {
		this.roleIds = roleIds;
	}
	
}
